package models

import "tuowei.com/common/models"

type SysPracticeRecord struct {
	models.Model
	ExType            int     `json:"ex_type"`
	ObjId             int     `json:"obj_id"`
	CorrectCount      int64   `json:"correct_count" gorm:"int(5);default:0;comment:正确数量"`
	ErrorCount        int64   `json:"error_count" gorm:"int(5);default:0;comment:错误数量"`
	CorrectRate       float64 `json:"correct_rate" gorm:"type:int(4);comment:正确率"`
	StartAnswerTime   int64   `json:"start_answer_time" comment:"答题开始时间"`
	EndAnswerTime     int64   `json:"end_answer_time" comment:"答题完成时间"`
	DurationStr       string  `json:"duration_str" gorm:"-"`
	NumberOfExercises int64   `json:"number_of_exercises" gorm:"smallint(5);comment:练习次数"`
	//Status                    int `json:"status" gorm:"type:tinyint(1);comment:答题状态"`
	AnswerSheet []*ExerciseRecordList `json:"answer_sheet" gorm:"-"`
	Name        string                `json:"name" gorm:"-"`
}

func (SysPracticeRecord) TableName() string {
	return "sys_practice_record"
}

type CorrectRate struct {
	models.Model
	StudentId                 int    `json:"student_id,omitempty" gorm:"type:int(5);comment:学生ID"`
	QuestionBankId            int    `json:"question_bank_id,omitempty" gorm:"type:int(5);comment:练习题ID"`
	CompletedSingleCount      int    `json:"completed_single_count,omitempty" gorm:"smallint(2);default:0;comment:完成单选题数量"`
	CompletedMultipleCount    int    `json:"completed_multiple_count,omitempty" gorm:"smallint(2);default:0;comment:完成多选题数量"`
	CompletedJudgmentCount    int    `json:"completed_judgment_count,omitempty" gorm:"smallint(2);default:0;comment:完成判断题数量"`
	CompletedApplicationCount int    `json:"completed_application_count,omitempty" gorm:"smallint(2);default:0;comment:完成应用题数量"`
	CorrectCount              int    `json:"correct_count,omitempty" gorm:"int(5);default:0;comment:正确数量"`
	ErrorCount                int    `json:"error_count,omitempty" gorm:"int(5);default:0;comment:错误数量"`
	CorrectRate               int    `json:"correct_rate,omitempty" gorm:"type:int(4);comment:正确率"`
	Duration                  int    `json:"duration,omitempty" gorm:"smallint(5);comment:答题时长"`
	NumberOfExercises         int    `json:"number_of_exercises,omitempty" gorm:"smallint(5);comment:练习次数"`
	Status                    int    `json:"status,omitempty" gorm:"type:tinyint(1);comment:答题状态"`
	Remark                    string `json:"remark,omitempty"`
	RemarkLabel               string `json:"remark_label" comment:"start，continue，no_auth" gorm:"-"`
	CompletedCount            int    `json:"completed_count,omitempty"`
}

func (CorrectRate) TableName() string {
	return "sys_practice_record"
}

type SysPracticeRecordInsert struct {
	models.Model
	StudentId         int   `json:"student_id,omitempty" gorm:"type:int(5);comment:学生ID"`
	ChapterId         int   `json:"chapter_id" gorm:"type:int(5);comment:章节ID"`
	ObjId             int   `json:"obj_id,omitempty" gorm:"type:int(5);comment:练习题ID"`
	ExType            int   `json:"ex_type" gorm:"type:tinyint(1);comment:1-网课练习 2-题库练习 3-模拟考试"`
	CorrectCount      int   `json:"correct_count,omitempty" gorm:"int(5);default:0;comment:正确数量"`
	ErrorCount        int   `json:"error_count,omitempty" gorm:"int(5);default:0;comment:错误数量"`
	StartAnswerTime   int64 `json:"start_answer_time" gorm:"smallint(5);comment:答题开始时间"`
	NumberOfExercises int   `json:"number_of_exercises,omitempty" gorm:"smallint(5);comment:练习次数"`
	Status            int   `json:"status,omitempty" gorm:"type:tinyint(1);comment:答题状态 -1未开始 1-进行中 2-已完成"`
}

func (SysPracticeRecordInsert) TableName() string {
	return "sys_practice_record"
}

type PracticeRecord struct {
	models.Model
	LastLeaveQuestionBankId int `json:"last_leave_question_bank_id" gorm:"type:int(10);comment:离开时正在开始的题目ID"`
}

func (PracticeRecord) TableName() string {
	return "sys_practice_record"
}

type PracticeRecordList struct {
	models.Model
	ObjId        int `json:"obj_id"`
	ExerciseType int `json:"exercise_type" gorm:"column:ex_type"`
	//Name         string  `json:"name"`
	Count        int     `json:"count" gorm:"-"`
	CorrectCount int64   `json:"correct_count" gorm:"int(5);default:0;comment:正确数量"`
	ErrorCount   int64   `json:"error_count" gorm:"int(5);default:0;comment:错误数量"`
	CorrectRate  float64 `json:"correct_rate" gorm:"type:int(4);comment:正确率"`
	Status       int     `json:"status"`
}

func (PracticeRecordList) TableName() string {
	return "sys_practice_record"
}

type PracticesRecordList struct {
	models.Model
	ObjId        int    `json:"obj_id"`
	ExerciseType int    `json:"exercise_type" gorm:"column:ex_type"`
	Name         string `json:"name"`
	Count        int    `json:"count"`
	CorrectCount int64  `json:"correct_count" gorm:"int(5);default:0;comment:正确数量"`
	ErrorCount   int64  `json:"error_count" gorm:"int(5);default:0;comment:错误数量"`
	CorrectRate  string `json:"correct_rate" gorm:"-"`
	Status       int    `json:"status"`
}

//func (PracticesRecordList) TableName() string {
//	return "sys_practice_record"
//}
